#!/bin/bash
set -e
ulimit -n 1000000
cd "{{ deploy_dir }}" || exit 1

export RUST_BACKTRACE=1

export TZ=${TZ:-/etc/localtime}

echo -n 'sync ... '
stat=$(time sync)
echo ok
echo $stat

if [ `ps aux |grep tikv-importer |grep $(cat status/tikv-importer.pid) |wc -l` -eq 1 ];then
        kill `cat status/tikv-importer.pid`
fi
